package com.minimalist.common.entity.lindi.vo.subsidyapplication;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标交易平台_补贴申请镇街明细 VO类。
 *
 * @author 11987
 * @since 2025-07-08
 */
@Schema(name = "林地指标交易平台_补贴申请镇街明细实体")
public class LindiSubsidyApplicationTownItemVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    // ========== 基本信息 ==========

    /**
     * 补贴申请镇街明细ID
     */
    @NotNull(message = "补贴申请镇街明细ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "subsidyApplicationTownItem", description = "补贴申请镇街明细ID", type = "string")
    private Long subsidyApplicationTownItem;

    /**
     * 补贴申请ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "subsidyApplicationId", description = "补贴申请ID", type = "string")
    private Long subsidyApplicationId;

    /**
     * 镇街名称
     */
    @NotBlank(message = "镇街名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "townName", description = "镇街名称", type = "string")
    private String townName;

    /**
     * 验收亩数
     */
    @NotBlank(message = "验收亩数不能为空", groups = {Add.class, Update.class})
    @Schema(name = "acceptAcreage", description = "验收亩数", type = "string")
    private String acceptAcreage;

    /**
     * 总金额
     */
    @NotBlank(message = "总金额不能为空", groups = {Add.class, Update.class})
    @Schema(name = "totalAmount", description = "总金额(万元)", type = "string")
    private String totalAmount;

    // ========== 审计字段 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @Schema(name = "createName", description = "创建人姓名", type = "string")
    private String createName;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "createTime", description = "创建时间", type = "string")
    private LocalDateTime createTime;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "updateTime", description = "更新时间", type = "string")
    private LocalDateTime updateTime;

    // ========== 构造函数 ==========

    /**
     * 默认构造函数
     */
    public LindiSubsidyApplicationTownItemVO(){
    }

    /**
     * 全参数构造函数
     *
     * @param subsidyApplicationTownItem 补贴申请镇街明细ID
     * @param subsidyApplicationId       补贴申请ID
     * @param townName                   镇街名称
     * @param acceptAcreage              验收亩数
     * @param totalAmount                总金额
     * @param createId                   创建人ID
     * @param createName                 创建人姓名
     * @param createTime                 创建时间
     * @param updateId                   更新人ID
     * @param updateTime                 更新时间
     */
    public LindiSubsidyApplicationTownItemVO(Long subsidyApplicationTownItem, Long subsidyApplicationId,
                                             String townName, String acceptAcreage, String totalAmount,
                                             Long createId, String createName, LocalDateTime createTime,
                                             Long updateId, LocalDateTime updateTime){
        this.subsidyApplicationTownItem = subsidyApplicationTownItem;
        this.subsidyApplicationId = subsidyApplicationId;
        this.townName = townName;
        this.acceptAcreage = acceptAcreage;
        this.totalAmount = totalAmount;
        this.createId = createId;
        this.createName = createName;
        this.createTime = createTime;
        this.updateId = updateId;
        this.updateTime = updateTime;
    }

    // ========== Getter 和 Setter 方法 ==========

    public Long getSubsidyApplicationTownItem(){
        return subsidyApplicationTownItem;
    }

    public void setSubsidyApplicationTownItem(Long subsidyApplicationTownItem){
        this.subsidyApplicationTownItem = subsidyApplicationTownItem;
    }

    public Long getSubsidyApplicationId(){
        return subsidyApplicationId;
    }

    public void setSubsidyApplicationId(Long subsidyApplicationId){
        this.subsidyApplicationId = subsidyApplicationId;
    }

    public String getTownName(){
        return townName;
    }

    public void setTownName(String townName){
        this.townName = townName;
    }

    public String getAcceptAcreage(){
        return acceptAcreage;
    }

    public void setAcceptAcreage(String acceptAcreage){
        this.acceptAcreage = acceptAcreage;
    }

    public String getTotalAmount(){
        return totalAmount;
    }

    public void setTotalAmount(String totalAmount){
        this.totalAmount = totalAmount;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public String getCreateName(){
        return createName;
    }

    public void setCreateName(String createName){
        this.createName = createName;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    // ========== equals、hashCode、toString ==========

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }

        LindiSubsidyApplicationTownItemVO that = (LindiSubsidyApplicationTownItemVO) o;

        return Objects.equals(subsidyApplicationTownItem, that.subsidyApplicationTownItem) &&
                Objects.equals(subsidyApplicationId, that.subsidyApplicationId) &&
                Objects.equals(townName, that.townName) &&
                Objects.equals(acceptAcreage, that.acceptAcreage) &&
                Objects.equals(totalAmount, that.totalAmount) &&
                Objects.equals(createId, that.createId) &&
                Objects.equals(createName, that.createName) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(updateId, that.updateId) &&
                Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(subsidyApplicationTownItem, subsidyApplicationId,
                townName, acceptAcreage, totalAmount,
                createId, createName, createTime, updateId, updateTime);
    }

    @Override
    public String toString(){
        return "LindiSubsidyApplicationTownItemVO{" +
                "subsidyApplicationTownItem=" + subsidyApplicationTownItem +
                ", subsidyApplicationId=" + subsidyApplicationId +
                ", townName='" + townName + '\'' +
                ", acceptAcreage='" + acceptAcreage + '\'' +
                ", totalAmount='" + totalAmount + '\'' +
                ", createId=" + createId +
                ", createName='" + createName + '\'' +
                ", createTime=" + createTime +
                ", updateId=" + updateId +
                ", updateTime=" + updateTime +
                '}';
    }

    // ========== Builder 模式 ==========

    /**
     * 创建 Builder 实例
     *
     * @return Builder 实例
     */
    public static Builder builder(){
        return new Builder();
    }

    /**
     * Builder 类
     */
    public static class Builder{
        private Long subsidyApplicationTownItem;
        private Long subsidyApplicationId;
        private String townName;
        private String acceptAcreage;
        private String totalAmount;
        private Long createId;
        private String createName;
        private LocalDateTime createTime;
        private Long updateId;
        private LocalDateTime updateTime;

        public Builder subsidyApplicationTownItem(Long subsidyApplicationTownItem){
            this.subsidyApplicationTownItem = subsidyApplicationTownItem;
            return this;
        }

        public Builder subsidyApplicationId(Long subsidyApplicationId){
            this.subsidyApplicationId = subsidyApplicationId;
            return this;
        }

        public Builder townName(String townName){
            this.townName = townName;
            return this;
        }

        public Builder acceptAcreage(String acceptAcreage){
            this.acceptAcreage = acceptAcreage;
            return this;
        }

        public Builder totalAmount(String totalAmount){
            this.totalAmount = totalAmount;
            return this;
        }

        public Builder createId(Long createId){
            this.createId = createId;
            return this;
        }

        public Builder createName(String createName){
            this.createName = createName;
            return this;
        }

        public Builder createTime(LocalDateTime createTime){
            this.createTime = createTime;
            return this;
        }

        public Builder updateId(Long updateId){
            this.updateId = updateId;
            return this;
        }

        public Builder updateTime(LocalDateTime updateTime){
            this.updateTime = updateTime;
            return this;
        }

        public LindiSubsidyApplicationTownItemVO build(){
            return new LindiSubsidyApplicationTownItemVO(subsidyApplicationTownItem, subsidyApplicationId,
                    townName, acceptAcreage, totalAmount,
                    createId, createName, createTime,
                    updateId, updateTime);
        }
    }

}